package cn.wx.feignClient;

import cn.wx.domain.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFallbackFactory implements FallbackFactory<UserFeignClient> {

    //此方法为了降级后的执行
    @Override
    public UserFeignClient create(Throwable throwable) {
       return new UserFeignClient() {
            @Override
            public User getUser(Long id) {
                return new User(id,"高渐离","断熔了");
            }
        };
    }
}
